﻿using System;
using System.ComponentModel.Composition;
using CodeCounsel.SharePoint.DevTools.Commands;
using Microsoft.VisualStudio.SharePoint.Deployment;

namespace CodeCounsel.SharePoint.DevTools.DeploymentSteps
{
    [Export(typeof(IDeploymentStep))]
    [DeploymentStep(DeploymentStepIds.InstallAppBinContent)]
    public class InstallAppBinContent
        : IDeploymentStep
    {
        public void Initialize(IDeploymentStepInfo stepInfo)
        {
            stepInfo.Name = "Install Application Content";
            stepInfo.StatusBarMessage = "Installing application content...";
            stepInfo.Description = "Copies shared application data to existing Web Application folders.";
        }

        public bool CanExecute(IDeploymentContext context)
        {
            return true;
        }

        public void Execute(IDeploymentContext context)
        {
            context.Project.SharePointConnection.ExecuteCommand(CommandIDs.CopyAppBinContent);
        }
    }
}